package com.hatic.money;

import java.util.Map;

import org.jxstar.service.BusinessObject;
import org.jxstar.util.factory.FactoryUtil;

/**
 * 取设备部门信息
 *
 * @author TonyTan
 * @version 1.0, 2011-11-3
 */
public class DeviceDept extends BusinessObject {
	private static final long serialVersionUID = 1L;
	
	private static Map<String,String[]> deviceDept = FactoryUtil.newMap();
	
	static {
		deviceDept.put("1001", new String[]{"10010014",	"0114",	"装备部"});
		deviceDept.put("1002", new String[]{"10020001",	"0201",	"新郑设备管理部"});
		deviceDept.put("1003", new String[]{"10030001",	"0301",	"郑州设备管理部"});
		deviceDept.put("1004", new String[]{"10040013",	"0413",	"许昌设备管理部"});
		deviceDept.put("1005", new String[]{"10050013",	"0513",	"安阳设备管理部"});
		deviceDept.put("1006", new String[]{"10060012",	"0612",	"南阳设备管理部"});
		deviceDept.put("1007", new String[]{"10070005",	"0705",	"驻马店设备管理部"});
		deviceDept.put("1008", new String[]{"10080017",	"0817",	"漯河设备管理部"});
		deviceDept.put("1009", new String[]{"10090009",	"0909",	"洛阳设备管理部"});
	}

	public static String getDeptId(String deptId) {
		String rootId = deptId.substring(0, 4);
		String[] depts = deviceDept.get(rootId);
		//如果找不到就去公司装备部
		if (depts == null) {
			depts = deviceDept.get("1001");
		}
		
		return depts[0];
	}
	
	public static String getDeptCode(String deptId) {
		String rootId = deptId.substring(0, 4);
		String[] depts = deviceDept.get(rootId);
		//如果找不到就去公司装备部
		if (depts == null) {
			depts = deviceDept.get("1001");
		}
		
		return depts[1];
	}
	
	public static String getDeptName(String deptId) {
		String rootId = deptId.substring(0, 4);
		String[] depts = deviceDept.get(rootId);
		//如果找不到就去公司装备部
		if (depts == null) {
			depts = deviceDept.get("1001");
		}
		
		return depts[2];
	}
}
